package com.example.controller;

import com.example.pojo.Author;
import com.example.pojo.Login;
import com.example.pojo.Result;
import com.example.service.AuthorService;
import com.example.service.LoginService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

@Slf4j
@RestController
public class LoginController {
    @Autowired
    private LoginService loginService;
    @PostMapping("/login")
    public Result login(@RequestBody Login login){
        Login info = loginService.login1(login);
        if(info != null)
        {
            return Result.success(info);
        }
        return Result.error("用户名或密码错误");
    }
}
